///
/// Event handler for Button. Add custom logic to display an error message on ${Button Control}_Click
///
public override void ${Button Control}_Click(object sender, EventArgs args)
{
// Add your logic to decide when to display alert message
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "MyAlertName", "My Alert Text");
// If you are redirecting to some other page then, it should not redirect when you display the alert message. Otherwise, the alert message will not be displayed.
// For this, you can use the following logic:
// bool shouldRedirect = true;
// if ("Show alert message codition is true") {
// BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "MyAlertName", "My Alert Text");
// shouldRedirect = false;
// }
// if (shouldRedirect) {
// this.Page.ShouldSaveControlsToSession = true;
// this.Page.Response.Redirect(url);
// }
}
|